package com.project.controller;

import com.project.bean.ClassBean;
import com.project.service.IClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("class")
public class ClassController {
    @Autowired
    private IClassService classService;

    @RequestMapping("findAll")
    public List<ClassBean> findAll() {
        return classService.findAll();
    }

    @RequestMapping("add")
    public String add(ClassBean classBean) {
        classService.add(classBean);
        return "ok";
    }

    @RequestMapping("del")
    public String del(Integer id) {
        boolean flag = classService.del(id);
        if (flag) {
            return "ok";
        } else {
            return "no";
        }
    }
}
